package Threads.GeekBang_test.ThreadLocal_test;


//多线程共享一个变量，会导致问题
public class test1 {
    private String content;

    private String getContent(){
        return content;
    }

    private void setConent(String content){
        this.content=content;
    }

    public static void main(String[] args) {
        test1 test1=new test1();
        for (int i=0;i<5;i++){
            new Thread(()->{
                test1.setConent(Thread.currentThread().getName()+"data");
                System.out.println("--------");
                System.out.println(Thread.currentThread().getName()+test1.getContent());
            },"t"+i).start();
        }
    }
}
